import{reqGetFileListByToken,reqDeleteFile} from "@/api/file";
import {requestGetData, requestIsSuccess} from "@/api/request";

const state={
    fileList:[]
}
const mutations={
    GETFILELIST(state,fileList){
        state.fileList=fileList
    }
}
const actions={
    async getFileListByToken({commit}) {
        const result = await reqGetFileListByToken();
        if(requestIsSuccess(result)){
            commit('GETFILELIST',requestGetData(result))
        }
    },
    async deleteFile({commit}, {id, source}){
        const result = await reqDeleteFile(id,source);
        return result;
    }
}
const getters={

}
export default {
    state,mutations,actions,getters
}